﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ExpUpload.aspx.cs" Inherits="CURE.Experiment.ExpUpload" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
    <script type="text/javascript">
        $(function () {
            $.ajax({
                url: "/Handler/ExpFileHandler.ashx?ledgerid=<%=Ledgerid%>",
                type: "post",
                success: function (data) {
                    //var ss = document.getElementById("filetable").innerHTML = data;
                   $("#filetable").html(data);
                   
                    // $("#filetable").html(data);

                }
            })
        })


        $("#file_upload").uploadify({
            'uploader': '/script/uploadify/scripts/uploadify.swf',
            'script': '/Handler/FileUploadHandler.ashx?str=<%=Id%>_<%=Ledgerid%>',
            'cancelImg':'/Script/uploadify/scripts/cancel.png',
            'folder': '/',
            'sizelimit': 10240 * 10240 * 5,
            'multi': true,
            'auto': false,/*如果是自动上传,那上传按钮将没用了*/
            'queueid': 'filequeue',
            'wmode': 'opaque',
            'onSelect': function (event, id, fileobj) {
                //$("#displaymsg").html("上传中......");
            },
            'onComplete': function (event, queueid, fileobj, response, data) {
                $.ajax({
                    url: "/Handler/ExpFileHandler.ashx?ledgerid=<%=Ledgerid%>",
                     type: "post",
                     success: function (data) {
                         
                         //document.getElementById("filetable").innerHTML = data;
                          $("#filetable").html(data);

                     }
                 })
                
               // $("#div_show_files").attr("src", response);
                
            }
        });
       
        function StartUpload() {
            $('#file_upload').uploadifyUpload();
        }

        function DeleteFile(id,path) {
            
            if (confirm('确认删除附件吗?')) {
                
                $.ajax({
                    url: "/Handler/FileDeleteHandler.ashx?",
                    data: { id: id, path: path },
                    type: "post",
                    success: function (data) {
                        //var ss = document.getElementById("filetable").innerHTML = data;
                        if (data == "success") {
                            $.ajax({
                                url: "/Handler/ExpFileHandler.ashx?ledgerid=<%=Ledgerid%>",
                                 type: "post",
                                 success: function (data) {
                                     //var ss = document.getElementById("filetable").innerHTML = data;
                                     $("#filetable").html(data);
                                     
                                     // $("#filetable").html(data);

                                 }
                             })
                        }

                        // $("#filetable").html(data);

                    }
                })

                return false;
            } else {
                return false;
            }
        }

       
    </script>
</head>
<body>
    <div class="pageContent">
        <form id="form1">
        <div class="pageFormContent" layouth="56">
            
          <div>
               <input type="file" name="file_upload" id="file_upload" />
               <input type="button" onclick="StartUpload()" value="上传" />
              
           </div>
            <div><span style="color:red;">上传同名同后缀附件将会自动覆盖</span></div>
           <%--<div id="filetable"></div>--%>
            <div id="filetable">
            
            </div>
            
        </div>
                
        
        </form>
    </div>
</body>
</html>
